﻿using System;
using System.Globalization;
using FlickrApi.Configuration;

namespace FlickrApi.Models
{
    public sealed class PhotoSet
    {
        internal IFlickrApiConfiguration Configuration { get; set; }
        public string Id { get; set; }
        public string PrimaryPhotoId { get; set; }
        public string Secret { get; set; }
        public string Server { get; set; }
        public long Farm { get; set; }
        public long CountPhotos { get; set; }
        public long CountVideos { get; set; }
        public long CountViews { get; set; }
        public long CountComments { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public DateTime CreatedDataTime { get; set; }
        public DateTime UpdatedDateTime { get; set; }
        public string CoverUrl
        {
            get
            {
                return Configuration.UrlFormatString
                        .Replace("{farm-id}", Farm.ToString(CultureInfo.InvariantCulture))
                        .Replace("{server-id}", Server)
                        .Replace("{id}", PrimaryPhotoId)
                        .Replace("{secret}", Secret)
                        .Replace("{suffix}", "_m");
            }
        }

    }
}
